bitkeeper revision 1.1041.15.2 (40ebf599xwzX2YRHxQvVAFkLp9CM5g)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Wed, 7 Jul 2004 13:07:37 +0000 (13:07 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Wed, 7 Jul 2004 13:07:37 +0000 (13:07 +0000)
Fix disconnect handling in netif/blkif drivers.
Add debug tracing to control-interface routines.

linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/interface.c
linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/common.h
linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/interface.c
linux-2.4.26-xen-sparse/arch/xen/kernel/ctrl_if.c

index 16b37164ab89199c0c101e279877d0a9d42dd802..a555b18e720aede74c9ff3b01ddaf2cd70ff80de 100644 (file)
@@ -220,9 +220,11 @@ int blkif_disconnect(blkif_be_disconnect_t *disconnect, u8 rsp_id)
         free_irq(blkif->irq, blkif);
         blkif_deschedule(blkif);
         blkif_put(blkif);
+        return 0; /* Caller should not send response message. */
     }
 
-    return 0; /* Caller should not send response message. */
+    disconnect->status = BLKIF_BE_STATUS_OKAY;
+    return 1;
 }
 
 void __init blkif_interface_init(void)
index f3eff0d81b2fb74270785ec74893edda1be778c7..87fdb730d1368c7c82682d5050c261c505ba59f1 100644 (file)
@@ -21,7 +21,7 @@
 #define ASSERT(_p) \
     if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
     __LINE__, __FILE__); *(int*)0=0; }
-#define DPRINTK(_f, _a...) printk("(file=%s, line=%d) " _f, \
+#define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
                            __FILE__ , __LINE__ , ## _a )
 #else
 #define ASSERT(_p) ((void)0)
index ff3bc7bbf746a2e5fcbdd627ce5667377ea95a76..757d10ba2c11fa8cfd10aa2b5497e80d6787149e 100644 (file)
@@ -269,9 +269,11 @@ int netif_disconnect(netif_be_disconnect_t *disconnect, u8 rsp_id)
         free_irq(netif->irq, netif);
         netif_deschedule(netif);
         netif_put(netif);
+        return 0; /* Caller should not send response message. */
     }
 
-    return 0; /* Caller should not send response message. */
+    disconnect->status = NETIF_BE_STATUS_OKAY;
+    return 1;
 }
 
 void netif_interface_init(void)
index 0e6389406ca61784b3dde1b9ef7dba69f38b8eda..f208efe1000d607c6589480c99cbe82cc6163e70 100644 (file)
 #include <asm/ctrl_if.h>
 #include <asm/evtchn.h>
 
+#if 0
+#define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
+                           __FILE__ , __LINE__ , ## _a )
+#else
+#define DPRINTK(_f, _a...) ((void)0)
+#endif
+
 /*
  * Only used by initial domain which must create its own control-interface
  * event channel. This value is picked up by the user-space domain controller
@@ -86,6 +93,11 @@ static void __ctrl_if_tx_tasklet(unsigned long data)
     {
         msg = &ctrl_if->tx_ring[MASK_CONTROL_IDX(ctrl_if_tx_resp_cons)];
 
+        DPRINTK("Rx-Rsp %u/%u :: %d/%d\n", 
+                ctrl_if_tx_resp_cons,
+                ctrl_if->tx_resp_prod,
+                msg->type, msg->subtype);
+
         /* Execute the callback handler, if one was specified. */
         if ( msg->id != 0xFF )
         {
@@ -131,8 +143,15 @@ static void __ctrl_if_rx_tasklet(unsigned long data)
     {
         pmsg = &ctrl_if->rx_ring[MASK_CONTROL_IDX(ctrl_if_rx_req_cons++)];
         memcpy(&msg, pmsg, offsetof(ctrl_msg_t, msg));
+
+        DPRINTK("Rx-Req %u/%u :: %d/%d\n", 
+                ctrl_if_rx_req_cons-1,
+                ctrl_if->rx_req_prod,
+                msg.type, msg.subtype);
+
         if ( msg.length != 0 )
             memcpy(msg.msg, pmsg->msg, msg.length);
+
         if ( test_bit(msg.type, &ctrl_if_rxmsg_blocking_context) )
         {
             pmsg = &ctrl_if_rxmsg_deferred[MASK_CONTROL_IDX(
@@ -185,6 +204,11 @@ int ctrl_if_send_message_noblock(
         msg->id = i;
     }
 
+    DPRINTK("Tx-Req %u/%u :: %d/%d\n", 
+            ctrl_if->tx_req_prod, 
+            ctrl_if_tx_resp_cons,
+            msg->type, msg->subtype);
+
     memcpy(&ctrl_if->tx_ring[MASK_CONTROL_IDX(ctrl_if->tx_req_prod)], 
            msg, sizeof(*msg));
     wmb(); /* Write the message before letting the controller peek at it. */
@@ -262,11 +286,18 @@ void ctrl_if_send_response(ctrl_msg_t *msg)
      * In this situation we may have src==dst, so no copying is required.
      */
     spin_lock_irqsave(&ctrl_if_lock, flags);
+
+    DPRINTK("Tx-Rsp %u :: %d/%d\n", 
+            ctrl_if->rx_resp_prod, 
+            msg->type, msg->subtype);
+
     dmsg = &ctrl_if->rx_ring[MASK_CONTROL_IDX(ctrl_if->rx_resp_prod)];
     if ( dmsg != msg )
         memcpy(dmsg, msg, sizeof(*msg));
+
     wmb(); /* Write the message before letting the controller peek at it. */
     ctrl_if->rx_resp_prod++;
+
     spin_unlock_irqrestore(&ctrl_if_lock, flags);
 
     ctrl_if_notify_controller();